package com.zzyl.controller;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.PendingTasksDto;

import com.zzyl.service.PendingTaskService;
import com.zzyl.utils.UserThreadLocal;
import com.zzyl.vo.PendingTaskVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/pending_tasks")
@Api(tags = "待办")
public class PendingTasksController extends BaseController {


    @Resource
    private PendingTaskService taskService;

    @PostMapping("/selectByPage")
    @ApiOperation(value = "查询待办")
    public ResponseResult<PageResponse<PendingTaskVo>> selectByPage(@RequestBody PendingTasksDto pendingTasksDto){
        //只查询有当前登录人的任务
        Long userId = getUserIdByName();

        pendingTasksDto.setAssigneeId(userId); //设置负责人为当前登录人

        return taskService.selectByPage(pendingTasksDto);
    }
}
